<template>
  <van-tabbar v-model="active">
    <van-tabbar-item icon="wap-home-o" @click="$troute.query('')"
      >首页</van-tabbar-item
    >
    <van-tabbar-item icon="star-o" @click=" isJump('activityList')"
      >活动</van-tabbar-item
    >
    <!-- <van-tabbar-item icon="chat-o" @click="$troute.query('myMessage')"
      >消息</van-tabbar-item
    > -->
    <van-tabbar-item icon="contact" @click="$troute.query('myIndex')"
      >我的</van-tabbar-item
    >
  </van-tabbar>
</template>

<script>
import Vue from "vue";
import { Tabbar, TabbarItem } from "vant";
import {mapState} from "vuex";
Vue.use(Tabbar);
Vue.use(TabbarItem);
export default {
  props: {
    index: {
      type: Number,
      default: 0,
    },
  },
  data() {
    return {
      active: this.$props.index,
    };
  },
  methods:{
    isShow:function (path){
      const show = this.menus.findIndex((value) => {
        return value == path
      })
      return show!=-1?true:false
    },
    isJump:function (path,topath){
      let link=!topath?path:topath
      if(this.isShow(path)){
        this.$troute.query(link)
      }else {
        this.$toast('没有权限')
      }
    },
  },
  computed:{
    ...mapState({
      menus: "menus"
    }),
  }
};
</script>

<style lang="scss" >
.van-tabbar-item--active{
  color: #e20010 !important;
}
</style>